package com.gujiayue.module.sys.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gujiayue.common.restful.RestfulRtnInfo;
import com.gujiayue.module.sys.pojo.query.QuerySysUsrList;
import com.gujiayue.module.sys.pojo.query.QuerySysUsrPage;
import com.gujiayue.module.sys.service.SysUsrService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

@Api(tags = "用户信息管理",value="用户信息管理")
@RestController
@RequestMapping(value = "sys/user")
@ApiResponses(value = {  
	@ApiResponse(code = 404, message = "失效得地址"),
	@ApiResponse(code = 403, message = "禁止执行访问 "),
	@ApiResponse(code = 401, message = "登录失败未授权"),
	@ApiResponse(code = 201, message = "请求成功"), 
})
public class SysUsrController {
	///sys/userget_views
	@Resource
	private SysUsrService sysUsrService;

	@ApiOperation("查询单条用户数据")
	@PostMapping(value = "/get_detail")
	public RestfulRtnInfo getSysUsr(String id) {
		return new RestfulRtnInfo(400, "getSysUsr", sysUsrService.getSysUsr(id));
	}
	//sys/user/get_list
	@ApiOperation(notes = "分页查询所有数据", value = "分页查询所有数据")
	@PostMapping(value = "/get_list")
	public RestfulRtnInfo getList(@RequestBody QuerySysUsrPage searchPage) {
		return new RestfulRtnInfo(400, "getSysUsr", sysUsrService.pageList(searchPage));
	}
	
	@ApiOperation(notes = "分页查询所有数据", value = "分页查询所有数据")
	@PostMapping(value = "/get_lists")
	public RestfulRtnInfo findList(@RequestBody QuerySysUsrList list) {
		System.out.println("YYYY");
		return new RestfulRtnInfo(400, "getSysUsr", sysUsrService.findList(list));
	}
	
	@ApiOperation(notes = "分页查询所有数据", value = "分页查询所有数据")
	@PostMapping(value = "/get_view")
	public RestfulRtnInfo getView() {
		System.out.println("YYYY");
		return new RestfulRtnInfo(200, "getSysUsr");
	}
	
	@ApiOperation(notes = "分页查询所有数据", value = "分页查询所有数据")
	@GetMapping(value = "/get_views")
	public RestfulRtnInfo getViews() {
		System.out.println("YYYY");
		return new RestfulRtnInfo(200, "getSysUsr");
	}
	
	@ApiOperation(notes = "分页查询所有数据", value = "分页查询所有数据")
	@PostMapping(value = "/get_page")
	public RestfulRtnInfo cursorPage() {
		return new RestfulRtnInfo(400, "getSysUsr", sysUsrService.cursorPage("1,5"));
	}
}
